package com.boco.transnms.server.dao.path;

import com.boco.transnms.server.dao.base.AbstractDAO;
import com.boco.transnms.server.dao.base.DaoName;
import com.boco.transnms.common.dto.base.BoActionContext;
import com.boco.transnms.common.dto.*;
import com.boco.transnms.server.dao.base.ObjectGetTypeEnum;
import com.boco.transnms.common.dto.base.DboCollection;
import com.boco.transnms.common.dto.base.DataObjectList;
import com.boco.transnms.common.dto.base.BoQueryContext;

/**
 * <p>Title: TransNMS</p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: Boco Inter-Telecom INC</p>
 *
 * @author xuliguo
 * @version 1.0
 */
public class TranspathToTraphDAO extends AbstractDAO {
    public TranspathToTraphDAO() {
        super(DaoName.TranspathToTraphDAO);
    }

    public String addTranspathToTraph(BoActionContext actionContext, TranspathToTraph transpathtotraph) throws Exception {
       super.createObject(actionContext, transpathtotraph);
       return transpathtotraph.getCuid();
   }

   public void updateTranspathToTraph(BoActionContext actionContext, TranspathToTraph transpathToTraph) throws Exception {
           super.updateObject(actionContext, transpathToTraph);
    }

    public void deleteTranspathToTraph(BoActionContext actionContext, TranspathToTraph transpathToTraph) throws Exception {
            super.deleteObject(actionContext, transpathToTraph);
     }

     public DataObjectList getTranspathToTraph(BoActionContext actionContext, String selCondition) throws Exception{
          DataObjectList returnData;
          if (selCondition != null && selCondition.length()>2) {
              returnData = super.getObjectsBySql(selCondition, new TranspathToTraph(), ObjectGetTypeEnum.FULL);
          } else {
              returnData = super.getAllObjByClass(new TranspathToTraph(),  ObjectGetTypeEnum.FULL);
          }
          return returnData;
      }


     public DboCollection getTranspathToTraph(BoQueryContext queryContext, String selCondition) throws Exception {
            String sql = "select *  from " + TranspathToTraph.CLASS_NAME;
            if (selCondition != null && selCondition.length()>2) {
                sql = sql + " where " + selCondition;
            }
            DboCollection taskList = super.selectDBOs(queryContext, sql, new TranspathToTraph());

            return taskList;
    }


    public DataObjectList getTraphs(BoActionContext actionContext, String selCondition) throws Exception{
               DataObjectList returnData;
               if (selCondition != null && selCondition.length()>2) {
                   returnData = super.getObjectsBySql(selCondition, new Traph(), ObjectGetTypeEnum.FULL);
               } else {
                   returnData = super.getAllObjByClass(new Traph(),  ObjectGetTypeEnum.FULL);
               }
               return returnData;
     }

    public DataObjectList getTranspathToTraphByCondition(BoActionContext actionContext, String sql) throws Exception {
        return super.getObjectsBySql(sql, new TranspathToTraph(), ObjectGetTypeEnum.FULL);
    }


}
